package xupt.com.bolg.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import xupt.com.bolg.entity.Bolg;
import xupt.com.bolg.service.impl.BolgServiceImpl;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class ManagerBolgController {
    @Autowired
    BolgServiceImpl bolgService;
    @GetMapping("/manager/bolg/delete")
    public String deletebolg(HttpServletRequest request, Model model){
        String id = request.getParameter("id");
        Integer integer = Integer.valueOf(id);
        bolgService.deleteByID(integer);
        List<Bolg> all = bolgService.findAll();
        model.addAttribute("bolgs",all);
        return "bolg/managerbolglist";
    }
}
